import pandas as pd
from pyecharts.charts import  Bar
from pyecharts import  options as opts

data=pd.read_excel("星级评定与评论关系.xlsx")
star_num=list(data["一星数"])
diss=list(data["一星评论"])


c=(Bar(init_opts=opts.InitOpts(width="1000px",height="500px")))

c.add_xaxis(["1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19"])
c.add_yaxis("一星数",star_num,color='blue')
c.extend_axis(yaxis=opts.AxisOpts(type_="value", position="right"))
c.add_yaxis("一星评论",diss,color='red',yaxis_index=1)


c.set_global_opts(
    title_opts=opts.TitleOpts(title="星级评定与评论关系"),
    toolbox_opts=opts.ToolboxOpts(is_show=False)


)

c.render("星级评定与评论之间的相关性分析.html")
